Message communication of sensor and other data

ABSTRACT

A service may be provided that reads sensors, and that communicates information based on the sensor readings to applications. In one example, an operating system provides a sensor interface that allows programs that run on a machine to read the values of sensors (such as an accelerometer, light meter, etc.). A service may use the interface to read the value of sensors, and may receive subscriptions to sensor values from other programs. The service may then generate messages that contain the sensor value, and may provide these messages to programs that have subscribed to the messages. The messages may contain raw sensor data. Or, the messages may contain information that is derived from the sensor data and/or from other data.

CROSS-REFERENCE TO RELATED CASES

This is a continuation of U.S. patent application Ser. No. 13/626,870(now U.S. Pat. No. 9,032,418) entitled “Message communication of sensorand other data,” filed on Sep. 25, 2012, which is a continuation of U.S.patent application Ser. No. 12/565,740 (now U.S. Pat. No. 8,276,159),entitled “Message communication of sensor and other data,” filed on Sep.23, 2009.

BACKGROUND

Computers and other machines are often equipped with sensors that allowthe machine to detect various aspects of its environment. For example, amachine could be equipped with an accelerometer, Global PositioningSystem (GPS) receiver, light sensor, etc. These sensors allow themachine to detect motion, position, and ambient light, respectively.

A machine may provide some type of interface to the sensors so thatsoftware on the machine can read data from the sensors. For example, acomputer's operating system may provide an application programminginterface (API) that allows applications, and other programs, on thecomputer to read the sensor values. For example, a program could call anAPI function to obtain the current acceleration vector from theaccelerometer, or the current latitude and longitude from the GPSreceiver.

While a sensor interface, such as that described above, allows programsto read sensor values, for a program to use the sensor interfacedirectly may complicate the design of the software. Programs typicallyhave complex control flow loops that respond to various events.Including logic that reads the sensors and responds to sensor valuescomplicates the control flow, and other aspects, of the program. Due tothe complexity of using sensor data through a typical sensor interface,many programs do not make use of sensor data.

SUMMARY

Sensor data, and other kinds of data, may be provided to an application(or other type of program) through a simple lightweight messagingmechanism. In one example, a sensor service uses a sensor interface(such as a sensor API) to read sensor values. Programs that want toreceive sensor values may subscribe to sensor notifications through thesensor service. The sensor service may determine, based on varioustriggers (e.g., changes in sensor values, passage of time, etc.), togenerate messages that communicate sensor values to the subscribingprogram(s). For example, an application might subscribe to receiveaccelerometer readings. The sensor service could use a sensor API topoll the accelerometer periodically for its current readings, and couldgenerate a message whenever the accelerometer values change. Thismessage could then be sent to the subscribing application. Sinceapplications are typically built to handle messages and other types ofinterrupts received from external sources, the application can processthe messages using these kinds of message-handling mechanism. Designingthe application to receive and process the messages may be less complexthan designing the application to read sensor values directly throughthe sensor interface.

The sensor service may send raw sensor values to the applications. Orthe sensor service may process the sensor values in some way, and maysend information that is derived from the sensor values using high-levelabstractions. For example, the sensor service may use a high-level modelto detect a walking motion based on the pattern of changes inaccelerometer readings. In addition to using sensor data in suchhigh-level models, the sensor service may also use other data, such asdata from a database, data from a user's calendar, data from theInternet, etc. Thus, an application may subscribe to messages thatreport sensor data and/or message that report other types ofinformation.

This Summary is provided to introduce a selection of concepts in asimplified form that are further described below in the DetailedDescription. This Summary is not intended to identify key features oressential features of the claimed subject matter, nor is it intended tobe used to limit the scope of the claimed subject matter.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an example scenario in which messages maybe used to communicate sensor data, and other data, to applications.

FIG. 2 is a block diagram of an example in which a sensor service usessensor readings, and possibly other data, to create messages.

FIG. 3 is a flow diagram of an example process in which messages may begenerated and sent to programs.

FIG. 4 is a block diagram of example components that may be used inconnection with implementations of the subject matter described herein.

DETAILED DESCRIPTION

A machine, such as a computer, may be equipped with sensors that allowthe machine to detect feature of the environment in which it operates.For example, a machine could be equipped with a light sensor thatdetects the amount and/or color of light present at the machine. Or, themachine could be equipped with an accelerometer that detects changes inmotion, a Global Position System (GPS) receiver that detects changes inabsolute position, or some other type of sensor.

Machines typically have some kind of operating system which, among otherthings, provides an interface between the machine's hardware and thesoftware that runs on the machine. For example, an operating system mayprovide an application programming interface (API) that allows softwareto interact with the sensors. Thus, an application might call a functionprovided by the API to request the current acceleration vector (as readby the accelerometer), the current latitude and longitude (as read byGPS receiver), or some other sensor reading.

The way in which certain APIs are used can complicate the design of aprogram. For example, an API might provide a function that anapplication can call to request a sensor reading, as described above.While such a function allows an application to obtain the sensorreadings, incorporating such readings into the application's runtimeloop increase the complexity of the application. Such an applicationwould have to include code that requests a reading periodically, or thatrequests a reading in response to some kind of event. In general, anapplication that wants to read sensors with an API may have to includesignificant code to initialize and instantiate the API, and to managethe data that comes from the API. The fact that such code is called forin order to use the API may discourage some software designers fromusing sensor data in a program. Additionally, one implementation of anAPI—the Sensor API for the MICROSOFT WINDOWS operating systems—isdesigned in such a way each application that uses the API instantiates aseparate copy of the API, due to the in-process nature of the API. Insome situations involving large numbers of applications runningsimultaneously, and/or large numbers of sensors, this design may consumeexcess system resources. As an alternative making direct function callsto read sensors, a technology such as Component Object Model (COM) couldbe used. Thus, a COM object could obtain sensor readings (e.g., usingSensor API), and applications that want to obtain the readings couldimplement callbacks specified by the COM interface, which the COM objectwould use to send sensor data to the applications in response to certaintypes of events. However, in the context of reading sensors, a COMimplementation might consume more resources than are needed.

The subject matter herein uses a messaging protocol to communicatesensor information to applications. A sensor service acts as anintermediary between applications and a sensor interface, andcommunicates sensor data to the application in the form of messages.Thus, the sensor service uses the sensor interface (e.g., the Sensor APIfor the MICROSOFT WINDOWS operating systems) to obtain sensor data. Thesensor service also receives subscription requests from applications,whereby applications request to receive sensor data (or certain types ofsensor data). The sensor data then pushes, to the applications, messagescontaining sensor data to which the applications have subscribed. Themessaging protocol may be made simple and lightweight, thereby puttingrelatively little tax on a machine's resources.

In one example, the sensor service may simply pass along raw datareceived from sensors. However, in another example, the sensor servicemay refine the data in some way. For example, a light sensor reading maycontain detailed values in some color space (e.g., separate red, green,and blue values). However, if an application cares only about the colortemperature that is present at a machine, then the sensor service mightconvert the red, green, and blue values into a color temperature value,which it could provide to the application. Additionally, refinement ofdata can be based on information from multiple sensors, or oninformation other than the sensors themselves. For example, the sensorservice might contain logic that detects motion based on a combinationof accelerometer and GPS data, or might determine the location of thenearest restaurant (or gas station, or hospital) based on the currentlatitude and longitude (as read from the GPS receiver) and further basedon a database that indicates the latitude and longitude of certainestablishments. Once the sensor service is equipped with such logic, thesensor service can use the same basic message infrastructure to provideeither raw sensor data, or information based on arbitrary levels ofabstraction.

Turning now to the drawings, FIG. 1 shows an example scenario in whichmessages may be used to communicate sensor data, and other data, toapplications. In the scenario of FIG. 1, various sensors 102, 104, and106 collect various types of data. For example, sensor 102 may be alight sensor that detects the color and/or temperature of light in thevicinity of the light sensor. Sensor 104 may be an accelerometer thatdetects the direction and/or magnitude of acceleration that the sensoris undergoing. Sensor 106 may be a GPS receiver that communicates withsatellites in order to triangulate the sensor's current latitude andlongitude. Sensors 102, 104, and 106 may be attached to a particularcomputer or other machine (e.g., machine 108). In such a case, thesesensors effectively sense the acceleration, latitude, longitude, etc.,of the machine to which they are attached. However, sensors 102-106could be physically disassociated from machine 108. Moreover, FIG. 1shows an example in which the sensors are a light meter, anaccelerometer, and a GPS receiver, but the subject matter herein couldbe used with any type of sensor.

An operating environment present at machine 108 may provide a sensorapplication programming interface (API) 110. Sensor API 110 provides amechanism through which programs that execute on machine 108 mayinteract with sensors 102-106. An application (or an operating systemcomponent, a driver, a plug-in, etc.) could use sensor API 110 to readthe values of sensors 102-106. Thus, if a particular program wants toknow the current latitude and longitude of machine 108, then thatprogram could issue a call to a function provided by sensor API 110. Thefunction may communicate with the relevant hardware driver for the GPSreceiver (which is sensor 106 in this example), and may return thecurrent latitude and longitude readings. A set of functions thatprograms can call to read sensor values is one example implementation ofsensor API 110. However, sensor API 110 could be implemented in anyappropriate manner. As another example, sensor API 110 could beimplemented as a Component Object Model (COM) object, where a programimplements a set of callbacks that allows the COM object to communicatewith the program.

While an application program could interact with sensor API 110directly, in the example of FIG. 1 the direct consumer of theinformation that sensor API 110 provides is sensor service 112. Sensorservice 112 uses sensor API to gather data from sensors 102-106, andthen packages this sensor data (or information derived from the sensordata) in the form of messages, such as message 114. These messages maybe provided to an application, such as application 116. Sensor service112 may use a message service to deliver messages to applications. Themessage service could be provided by sensor service 112; or, sensorservice could make use of a message service that is provided by someother component (such as a message service that the operating systemprovides so as to allow different executable components on a givenmachine to communicate with each other). An application, such asapplication 116, may subscribe to certain sensor events by registeringwith sensor service 112 to receive notifications of those events. Forexample, application 116 might subscribe to receive notifications ofchanges in machine 108's latitude and longitude. In such an example,sensor service 112 might use sensor API 110 to poll sensor 106 (the GPSreceiver) periodically for the current latitude and longitude. Sensorservice 112 could then generate messages when the latitude and longitudechange, or could issue a message after the passage of some amount oftime (e.g., every minute) even if there is no change.

In addition to application 116, there could be one or more otherapplications on machine 108, such as applications 118 and 120. Theseapplications could register separately for notifications of certainevents (as indicated by the dashed lines from applications 118 and 120to sensor service 112). For example, application 118 might register toreceive notification of changes in acceleration, and application 120might register to receive notification of light readings andlatitude/longitude. Any application could register to receive any typeof messages from sensor service 112.

In one example, messages are used to convey raw sensor data. However, inother examples, message could be used to convey higher-level conclusionsthat are derived from sensor data, from other data, or from acombination of both sensor data and other data. For example, sensorservice 112 may obtain data 122 from sources other than the sensorsthemselves. Sensor service 112 may employ one or more high-level models124 that, when forming conclusions, take into account data from sensors102-106, other data 122, or some combination of sensor data and otherdata. For example, a high-level model could attempt to determine where aperson is going, based on a person's calendar, and also based on changedin the location of a device the person is carrying. In such a case, ahigh-level model could combine sensor data (latitude and longitudereported by a GPS receiver) with other data 122 (which, in this case,would be appointments from a person's calendar), in order to form aconclusion about where the person is going. (E.g., the model mightreason, “The person who owns this device is walking toward theadministration building, and has an appointment with the companypresident on his calendar; therefore, the person's current destinationis the office of the company president.”) An application could subscribeto “destination” notifications, and sensor service 112 could issue amessage to that application when an appropriate high level model hasdetermined where the person is going. It is noted that, when a model isused to draw conclusions from sensor data and/or from other data, theconclusions drawn by the model (and, therefore, the informationcontained in messages based on the model) would differ from the rawsensor data. Thus, if a model determines that a person is walking basedon changes in accelerometer readings, the messages that are sent to anapplication might indicate that a person has started and/or stoppedwalking. The accelerometer senses acceleration vectors, but does notsense the commencement or cessation of walking directly, and thusmessages based on a “walking” model would differ from the actual sensorreadings.

FIG. 2 shows an example of how a sensor service may use sensor readings,and possibly other data, to create messages. In the example of FIG. 2,sensor service 112 takes readings 202, 204, and 206, from a sensor.Sensor service may take readings 202-206 in any manner. For example,there may be a sensor interface (such as sensor API 110, shown in FIG.1), which allows programs to take sensor readings, although the subjectmatter herein is not limited to the example in which a sensor API isused.

In the example of FIG. 2, the sensor from which readings are taken isaccelerometer 208, although any type of sensor could be used. In thecase where the sensor is an accelerometer, that sensor may produceacceleration vectors as readings. For example, reading 202 contains anindication of a particular acceleration vector (given by theacceleration values in the X, Y, and Z dimensions). Readings 204 and 206could show the same values for the acceleration vector (if theacceleration does not change between readings), or could show differentvalues for the acceleration vector (if the acceleration vector haschanged between readings).

Sensor service 112 may generate messages based on sensor readings, wherethe messages are to be sent to subscribing applications. An application,such as application 210, may subscribe to certain types of messages byregistering with sensor service 112. In one example, application 210registers to receive sensor data. Thus, application 210 could receive amessage 212, which indicates that the acceleration vector has changed,and also indicates the current value of the acceleration vector. In theexample of FIG. 2, the sending of message 212 may be triggered by achange in the acceleration vector. That is, sensor service 112 couldmonitor accelerometer readings, and could send a message to subscribingapplications whenever the value of the sensor reading changes. However,sensor service 112 could send a message in response to any sort oftrigger, of which a change is a sensor reading is merely one example. Asanother example, sensor service 112 could send a message after thepassage of n units of time (e.g., after every n second), in which casethe passage of time is the trigger to send the message.

While sensor service 112 could send messages to report on sensorreadings, sensor service 112 could also send message to report onhigher-level concepts based on abstract models. For example, sensorservice 112 could send message 214 to indicate that a particular type ofmotion has started or stopped. In the example of FIG. 2, accelerometer208 might be attached to a device that can be carried by a person, andmessage 214 might indicate that the person is walking. The conclusionthat the person is walking might be based on the use of high-levelmodels of different types of motion to analyze the pattern of changes inthe acceleration vector. Thus, sensor service 112 could send messagesthat are based on raw sensor data (as in the case of message 212), orcould send messages that are based on conclusions that high-level modelsdraw from the sensor data (as in the case of message 214).

As noted above, in connection with FIG. 1, when sensor service 112 useshigh level models to generate messages, sensor service 112 may usesensor data, but may also use other data 122, which could be any type ofdata (e.g., data from a database, data from a user's calendar, dataretrieved from the Internet, etc.).

FIG. 3 shows, in the form of a flow chart, an example process in whichmessages may be generated and sent to subscribing applications. Beforeturning to a description of FIG. 3, it is noted that the flow diagram ofFIG. 3 is described, by way of example, with reference to componentsshown in FIGS. 1-2, although this processes may be carried out in anysystem and is not limited to the scenarios shown in FIGS. 1-2.Additionally, the flow diagram in FIG. 3 shows an example in whichstages of a process are carried out in a particular order, as indicatedby the lines connecting the blocks, but the various stages shown in thisdiagram can be performed in any order, or in any combination orsub-combination.

At 302, a subscription request may be received from an application (orother type of program). Thus, an application may subscribe to receivenotifications of sensor values, or to receive certain kinds of eventswith respect to sensor values. For example, an application mightsubscribe to receive accelerometer readings. The application mightsubscribe to a message reporting the acceleration vector every fiveseconds, or every time the acceleration vector changes, or in responseto some other trigger. The application might request all accelerationdata, or only certain acceleration data.

At 304, a sensor interface is used to read sensor value. For example,sensor service 112 (shown in FIG. 1) might use sensor API 110 (alsoshown in FIG. 1) to read sensor values. Sensor service 112 might have aloop that periodically reads those from the sensors using sensor API 110(or some other sensor interface), and that determines, based on thevalues and changes thereto, what messages to report.

At 306, models may be applied to sensor values. A model may attempt todraw conclusions from raw sensor data—e.g., a model might conclude thata device is being moved through human walking, based on an analysis ofacceleration vector readings. Models may be based solely on sensor data,or may be based on some combination of sensor data and other data 122,as previously described in connection with FIGS. 1 and 2. While a sensorservice could apply a model at 306, in an alternative example the sensorservice might apply no model and might simply report raw sensor data.

At 308, a message may be created to convey sensor data and/or to conveyconclusions formed by high-level models. In one example (e.g., incertain versions of the MICROSOFT WINDOWS operating systems), a messagewith the type “WM_CONTEXT” may be created, where the format of theWM_CONTEXT could be made generally known to software developers via apublished specification. Thus, third-party applications and otherthird-party programs can receive and interpret sensor data (and othertypes of information) that is conveyed in a WM_CONTEXT message. However,the subject matter herein is not limited to the use of a WM_CONTEXTmessage; any type of message could be used.

At 310, the message that was created may be provided to a subscribingapplication (or other program). For example, a messaging infrastructurecould be used to push a message, such as a WM_CONTEXT message, to anapplication that has subscribed to receive such messages.

At 312, the application (or other program) may take a tangible actionbased on the received message. For example, the application couldcommunicate information to a person based on the received message, orcould store information based on the message in some tangible form. Touse one example from above, if the message indicates the currentaccelerometer readings, an application could display the currentaccelerometer readings contained in the message.

FIG. 4 shows an example environment in which aspects of the subjectmatter described herein may be deployed.

Computer 400 includes one or more processors 402 and one or more dataremembrance components 404. Processor(s) 402 are typicallymicroprocessors, such as those found in a personal desktop or laptopcomputer, a server, a handheld computer, or another kind of computingdevice. Data remembrance component(s) 404 are components that arecapable of storing data for either the short or long term. Examples ofdata remembrance component(s) 404 include hard disks, removable disks(including optical and magnetic disks), volatile and non-volatilerandom-access memory (RAM), read-only memory (ROM), flash memory,magnetic tape, etc. Data remembrance component(s) are examples ofcomputer-readable storage media. Computer 400 may comprise, or beassociated with, display 412, which may be a cathode ray tube (CRT)monitor, a liquid crystal display (LCD) monitor, or any other type ofmonitor.

Software may be stored in the data remembrance component(s) 404, and mayexecute on the one or more processor(s) 402. An example of such softwareis message generation software 406, which may implement some or all ofthe functionality described above in connection with FIGS. 1-3, althoughany type of software could be used. Software 406 may be implemented, forexample, through one or more components, which may be components in adistributed system, separate files, separate functions, separateobjects, separate lines of code, etc. A computer (e.g., personalcomputer, server computer, handheld computer, etc.) in which a programis stored on hard disk, loaded into RAM, and executed on the computer'sprocessor(s) typifies the scenario depicted in FIG. 4, although thesubject matter described herein is not limited to this example.

The subject matter described herein can be implemented as software thatis stored in one or more of the data remembrance component(s) 404 andthat executes on one or more of the processor(s) 402. As anotherexample, the subject matter can be implemented as instructions that arestored on one or more computer-readable storage media. (Tangible media,such as an optical disks or magnetic disks, are examples of storagemedia.) Such instructions, when executed by a computer or other machine,may cause the computer or other machine to perform one or more acts of amethod. The instructions to perform the acts could be stored on onemedium, or could be spread out across plural media, so that theinstructions might appear collectively on the one or morecomputer-readable storage media, regardless of whether all of theinstructions happen to be on the same medium.

Additionally, any acts described herein (whether or not shown in adiagram) may be performed by a processor (e.g., one or more ofprocessors 402) as part of a method. Thus, if the acts A, B, and C aredescribed herein, then a method may be performed that comprises the actsof A, B, and C. Moreover, if the acts of A, B, and C are describedherein, then a method may be performed that comprises using a processorto perform the acts of A, B, and C.

In one example environment, computer 400 may be communicativelyconnected to one or more other devices through network 408. Computer410, which may be similar in structure to computer 400, is an example ofa device that can be connected to computer 400, although other types ofdevices may also be so connected.

Although the subject matter has been described in language specific tostructural features and/or methodological acts, it is to be understoodthat the subject matter defined in the appended claims is notnecessarily limited to the specific features or acts described above.Rather, the specific features and acts described above are disclosed asexample forms of implementing the claims.

The invention claimed is:
 1. One or more computer-readable storage mediathat comprise executable instructions to provide information to anapplication, wherein the executable instructions, when executed by acomputer, cause the computer to perform acts comprising: receiving, fromsaid application, a subscription request; using a sensor interface toobtain a reading from a sensor, said sensor interface comprisingsoftware that provides a mechanism through which sensor values arereadable by programs that use said sensor interface, said sensor beingphysically disassociated from said computer; and creating a messagebased on a set of one or more readings, wherein said set comprises saidreading.
 2. The one or more computer-readable storage media of claim 1,said computer being a handheld computer.
 3. The one or morecomputer-readable storage media of claim 1, said application taking anaction based on said message.
 4. The one or more computer-readablestorage media of claim 1, said acts being performed by a service, saidservice applying a model to said set of one or more readings in order tocreate said message, and said message comprising information thatdiffers from any of the readings in said set.
 5. The one or morecomputer-readable storage media of claim 1, said acts being performed bya service, said service applying a model to said set of one or morereadings in order to create said message, and said model taking intoaccount both said set of one or more readings and some data that is nota sensor reading.
 6. The one or more computer-readable storage media ofclaim 1, said sensor comprising an accelerometer, and wherein obtainingsaid reading from said sensor comprises obtaining an acceleration vectorfrom said sensor.
 7. The one or more computer-readable storage media ofclaim 1, said sensor comprising a light sensor, and wherein obtainingsaid reading from said sensor comprises obtaining an indication of (a) atemperature of light detected by said sensor, or (b) a color of lightdetected by said sensor.
 8. A method of providing information to aprogram, the method comprising: using a processor to perform actscomprising: receiving, from said program, a request to subscribe tonotifications from a service; at said service, using a programminginterface to obtain a reading from a sensor, said programming interfacebeing provided by an operating system that is present at a machine thatcomprises said processor, said sensor being physically detached fromsaid machine; creating a message that is based on a set of one or moresensor readings, wherein said set comprises said reading; and providingsaid message to said program.
 9. The method of claim 8, said operatingsystem providing a message service to send messages between componentsthat execute on said message, said providing of said message beingperformed using said message service.
 10. The method of claim 8, saidmessage being created by said service, said service, in creating saidmessage, taking into account both said set of sensor readings and somedata that is not a sensor reading.
 11. The method of claim 8, saidmessage being created by said service, said service applying a model tosaid set of one or more sensor readings in order to create said message,said message being different from the sensor readings in said set. 12.The method of claim 8, said message being created by said service, saidservice creating said message by applying a model to said set of one ormore sensor readings and to at least some data that is not a sensorreading, said message being different from the sensor readings in saidset.
 13. The method of claim 8, said sensor comprising a GlobalPositioning System (GPS) receiver, and said reading comprising latitudeand longitude readings from said GPS receiver.
 14. The method of claim8, said sensor comprising a light sensor, said reading comprising anindication of a temperature of light or a color of light detected bysaid sensor.
 15. A machine for providing information to an application,the machine comprising: a memory; a processor; and executableinstructions that are stored in said memory, that execute on saidprocessor, that receive, from said application, a subscription request,that use a sensor interface to obtain a reading from a sensor that isphysically disassociated from said machine, said sensor interfacecomprising software that provides a mechanism through which sensorvalues are readable by programs that use said sensor interface, and thatcreate a message based on a set of one or more readings, wherein saidset comprises said reading.
 16. The machine of claim 15, saidapplication taking an action based on said message.
 17. The machine ofclaim 15, said executable instructions implementing a service, saidservice applying a model to said set of one or more readings in order tocreate said message, and said message comprising information thatdiffers from any of the readings in said set.
 18. The machine of claim15, said executable instructions implementing a service, said serviceapplying a model to said set of one or more readings in order to createsaid message, and said model taking into account both said set of one ormore readings and some data that is not a sensor reading.
 19. Themachine of claim 15, said sensor comprising an accelerometer, andwherein obtaining said reading from said sensor comprises obtaining anacceleration vector from said sensor.
 20. The machine of claim 15, saidsensor comprising a light sensor, and wherein obtaining said readingfrom said sensor comprises obtaining an indication of (a) a temperatureof light detected by said sensor, or (b) a color of light detected bysaid sensor.